<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<head>

<script type="text/javascript">

function abc(){
	
	return window.confirm("你真的要删除吗？");
}
</script>

<style type="text/css">
#body{
      width: 980px;
      height: 800px;
      border:#333333 0px solid;
      margin:0px auto;
      background: url("http://d2.freep.cn/3tb_161228182847g0uw581281.jpg") no-repeat right;
    }
#rj {
	float:left;
	margin:280px 0px 0px 200px;
}
#tj1{
	position: absolute;
	left:1040px;
	top:210px;
}

#tj2{
	position: absolute;
	left:1052px;
	top:450px;
}

#zk{
	position: absolute;
	left:430px;
	top:-425px;
}
</style>

<title>Insert title here</title>
</head>
<body>
<div id="body">
 <div id="rj">
	<h1>我的日记</h1>
	<form action="find" method="post">
		请输入你想查找的标题:
		<br><br>
		<input type="text"	name="person">			
		<input type="submit" value="查找" >
	</form>
 </div>	
 
 	<div id="tj1">
	<!-- 输入部分 -->
				   <form action="add" method="post">
				
						有话想说？<br><br>
						标&nbsp;&nbsp;题：<input type="text" name="person"/><br><br>
						内&nbsp;&nbsp;容：<input type="text" name="context" /><br><br>
			 			
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="提交"> &nbsp;&nbsp;&nbsp;
						<input type="reset" value="重置">
					
				    </form>
	
								<%
									String aSuc=request.getParameter("aSuc");
									if(aSuc!=null){	
									   if(aSuc.equals("1")){
										%><br><br><%
										out.println("<font color=red >添加成功！</font>");}  
									  	}
							  	%>
	<br><br>
	</div>
	<div id="tj2">
	<!-- 留言板显示部分 -->
	
	
	&nbsp;&nbsp;&nbsp;<a href="userList" >显示所有数据</a><br><br>
	<div id="zk">
	<table border="1">
 			
	
 		<c:forEach var="selectALL" items="${userList}" >
	<table width="351" border="0"  background="http://v2.freep.cn/3tb_1612281809502ph7512293.jpg">
 		<tr><td></td><td>标题</td>	 <td>${selectALL.person}</td>     <tr>
 		<tr><td></td><td>内容</td>	 <td>${selectALL.context}</td>      <tr>
 		<tr><td></td><td>日记时间</td>	 <td><fmt:formatDate pattern="yyyy-MM-dd" value="${selectALL.date}" type="both"/></td>   <tr>
 		<tr><td>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      </td><td>
 			 <a href="update.jsp?ID=${selectALL.ID}&title=${selectALL.title}&context=${selectALL.context}&person=${selectALL.person}&date=<fmt:formatDate pattern="yyyy-MM-dd" value="${selectALL.date}" type="both"/>">修改</a>&nbsp;
 			 <a onclick="return abc();"href="deleteuser?ID=${selectALL.ID}">删除</a></td> <tr>
 		  <!-- pattern 日期格式  value显示的日期值   type 类型 -->
 			 </tr>
 			 <tr></tr>
 			 <tr></tr>
 			 <tr></tr>
 				
        
    
 	</table>
 	<br>
 	<br>
 	</c:forEach>

    
 	</table>
 	</div>
 	<br>
				 				<%
								String dSuc=request.getParameter("dSuc");
								if(dSuc!=null){
									
									if(dSuc.equals("1")){
										%><br><br><%
										out.println("<font color=red >删除成功！</font>");}  
									}
								%>
				 
					    	<%
								String err=request.getParameter("err");
								if(err!=null){
									
									if(err.equals("1")){
										%><br><br><%
										out.println("<font color=red >&nbsp;&nbsp;&nbsp;没有查询到该日记</font>");}  
									}
								%>
	
	</div>
</div>
</body>
</html>